Table Of Contents

Previous topic

Subsystem class

Next topic

FastNeighborList class

This Page

Interaction class

The Interaction class works as an interface for defining interactions and link atoms between subsystems in hybrid calulations. With the methods add_potential(), set_potentials(), enable_coulomb_potential() and enable_comb_potential() you can define the Pysic Potentials that are present between the subsystems. With add_hydrogen_links() you can setup the hydrogen link atoms.

Full documentation of the Interaction class

class pysic.interaction.Interaction(primary, secondary)[source]

Used to store information about a interaction between subsystems.

The end user can create and manipulate these objects when defining interactions between subsystems. The interactions between subsystems are added to the calculation by calling add_interaction() which adds a Interaction object to the calculation.

When the HybridCalculator sees fit, the subsystem bindings are materialized by converting the stored Interactions to InteractionInternals.

Attributes:
primary: string
Name of the primary subsystem.
secondary: string
Name of the secondary subsystem.
links: list of tuples
Contains a list of different link types. Each list item is a tuple with two items: the first is a list of link pairs, the second one is the CHL parameter for these links.
electrostatic_parameters: dictionary
Contains all the parameters used for creating a Coulomb potential.
coulomb_potential_enabled: bool
comb_potential_enabled: bool
link_atom_correction_enabled: bool
potentials: list of Potential

Defines hydrogen links in the system.

Parameters:
pairs: tuple or list of tuples
A set of tuples containing two indices, the first index in the tuple should point to the subsystem in which the hydrogen link atom is actually added to (=primary system).
CHL: float
Indicates the position of the hydrogen atom on the line defined by the atom pairs. Values should be between 0-1. 0 means that the link atom overlaps with the atom in the primary system, 1 means that the link atom overlaps with the atom in the secondary system. The scale is linear.
add_potential(potential)[source]

Used to add a Pysic potential between the subsystems.

Parameters:
potential: Potential
enable_comb_potential()[source]

Enable the COMB potential between the subsystems. Valid for Si-Si and Si-O interactions.

enable_coulomb_potential(epsilon=0.00552635, real_cutoff=None, k_cutoff=None, sigma=None)[source]

Enables the electrical Coulomb interaction between the subsystems.

Parameters:
epsilon: float
The vacumm permittivity. Has a default value from the literature, in Atomic units.
r_cutoff: float
Real space cutoff radius. Provide if system has periodic boundary conditions.
k_cutoff: float
Reciprocal space cutoff radius. Provide if system has periodic boundary conditions.
sigma: float
Ewald summation split parameter. Provide if system has periodic boundary conditions.

Sets whether the link interaction correction energy is calculated or not.

By default the correction is enabled, but you have to provide a secondary calculator that can calculate the interaction energies between the link atoms themselves and between link atoms and the primary system.

The link atom correction is defined as: .. math:

E^  ext{link} &= - E^       ext{int}_       ext{MM} ext{(PS, HL)} - E^      ext{tot}_       ext{MM} ext{(HL)}
set_potentials(potentials)[source]

Used to set a list of additional Pysic potentials between the subsystems.

Parameters:
potentials: list of or single Potential

InteractionInternal class

This class is meant for internal use only.

Full documentation of the InteractionInternal class

class pysic.interaction.InteractionInternal(full_system, primary_subsystem, secondary_subsystem, info)[source]

The internal version of the Interaction-class.

This class is meant only for internal use, and should not be accessed by the end-user.

Attributes:
info: :class:’~Pysic.interaction.Interaction’
Contains all the info about the interaction given by the user.
full_system: ASE Atoms
primary_subsystem: SubSystem
secondary_subsystem: SubSystem
uncorrected_interaction_energy: float
The interaction energy without the link atom correction.
uncorrected_interaction_forces: numpy array
The interaction forces without the link atom correction.
link_atom_correction_energy: float
link_atom_correction_forces: numpy array
interaction_energy: float
The total interaction energy = uncorrected_interaction_energy + link_atom_correction_energy
interaction_forces: numpy array
The total interaction forces = uncorrected_interaction_forces + link_atom_correction_forces
has_interaction_potentials: bool
True if any potentials are defined.
calculator: :class:’~pysic.calculator.Pysic’
The pysic calculator used for non-pbc systems.
pbc_calculator: :class:’~pysic.calculator.Pysic’
The pysic calculator used for pbc systems.
timer: :class:’~pysic.utility.timer.Timer’
Used for tracking time usage.
has_pbc: bool
link_atoms: ASE Atoms
Contains all the hydrogen link atoms. Needed when calculating link atom correction.
n_primary: int
Number of atoms in primary subsystem.
n_secondary: int
Number of atoms in secondary subsystem.
n_full: int
Number of atoms in full system.
n_links: int
Number of link atoms.

Calculates the link atom interaction energy defined as

\[E^\text{link} = -E^\text{tot}_\text{MM}(\text{HL})-E^\text{int}_\text{MM}(\text{PS, HL})\]

Calculates the link atom correction forces defined as

\[F^\text{link} = -\nabla(-E^\text{tot}_\text{MM}(\text{HL})-E^\text{int}_\text{MM}(\text{PS, HL}))\]
calculate_uncorrected_interaction_energy()[source]

Calculates the interaction energy of a non-pbc system without the link atom correction.

calculate_uncorrected_interaction_energy_pbc()[source]

Calculates the interaction energy of a pbc system without the link atom correction.

calculate_uncorrected_interaction_forces()[source]

Calculates the interaction forces of a non-pbc system without the link atom correction.

calculate_uncorrected_interaction_forces_pbc()[source]

Calculates the interaction forces of a pbc system without the link atom correction.

get_interaction_energy()[source]

Returns the total interaction energy which consists of the uncorrected energies and possible the link atom correction.

Returns:
float: the interaction energy
get_interaction_forces()[source]

Return a numpy array of total 3D forces for each atom in the whole system.

The forces consists of the uncorrected forces and possibly the link atom correction forces. The row index refers to the atom index in the original structure.

Returns:
numpy array: the forces for each atom in the full system
setup_comb_potential()[source]

Setups a COMB-potential between the subsystems.

setup_coulomb_potential()[source]

Setups a Coulomb potential between the subsystems.

Ewald calculation is automatically used for pbc-systems. Non-pbc systems use the ProductPotential to reproduce the Coulomb potential.

Setup the hydrogen link atoms to the primary system.

Parameters:
link_parameters: list of tuples
Contains the link atom parameters from the Interaction-object. Each tuple in the list is a link atom specification for a covalent bond of different type. The first item in the tuple is a list of tuples containing atom index pairs. The second item in the tuple is the CHL parameter for these links.
setup_potentials()[source]

Setups the additional Pysic potentials given in the Interaction-object.

Used to update the position of the hydrogen link atoms specified in this interaction

It is assumed that the position of the host atoms have already been updated.

update_subsystem_charges()[source]

Updates the charges in the subsystems involved in the interaction (if charge update is enabled in them).